#ifndef BLOCKSTOREMODEL_H
#define BLOCKSTOREMODEL_H

#include <QAbstractTableModel>
#include <QVector>

class BlockStoreModel : public QAbstractTableModel
{
    Q_OBJECT

public:
    enum BlockStatus {
        Available = 0,    // 绿色 - 可用
        Unavailable = 1   // 灰色 - 不可用
    };

    explicit BlockStoreModel(QObject *parent = nullptr);

    // QAbstractTableModel 接口
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    int columnCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;

    // 自定义方法
    void setBlockStatus(int blockNumber, BlockStatus status);
    BlockStatus getBlockStatus(int blockNumber) const;
    void resetAllBlocks();
    int getTotalAvailableCount() const;

private:
    static const int TOTAL_BLOCKS = 120;
    static const int CABINETS_COUNT = 5;
    static const int ROWS_PER_CABINET = 24;
    
    QVector<BlockStatus> m_blockStatuses;
};

#endif // BLOCKSTOREMODEL_H
